package com.leonzhangxf.aop.primary;

import com.leonzhangxf.aop.bean.HelloWorldService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * The demo of use {@link AnnotationConfigApplicationContext}
 * to perform spring IOC.
 *
 * @author leonzhangxf
 */
@Configuration
@ComponentScan({"com.leonzhangxf.aop.primary", "com.leonzhangxf.aop.primary"})
public class ApplicationContextForAopStarter {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext =
            new AnnotationConfigApplicationContext(ApplicationContextForAopStarter.class);

        HelloWorldService helloWorldService = applicationContext.getBean(HelloWorldService.class);
        helloWorldService.helloWorld();
        helloWorldService.helloWorld("hello leon");
    }
}
